| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Public Member Functions | Public Attributes | List of all members
nkMaths::Rectangle Class Reference

Represents a 2D rectangle. More...

## Public Member Functions
| Rectangle () noexcept
| Rectangle (float x, float y, float width, float height) noexcept
bool | pointInside (Point point) const
Rectangle | operator+ (const Rectangle &other) const

## Public Attributes
float | _x
| The x coordinate of the origin.
float | _y
| The y coordinate of the origin.
float | _width
| The full width of the rectangle.
float | _height
| The full height of the rectangle.

## Detailed Description

Represents a 2D rectangle.

## Constructor & Destructor Documentation

## ◆ Rectangle() [1/2]

nkMaths::Rectangle::Rectangle | ( |  | ) |
| noexcept

Default constructor. All members will be set to 0.

## ◆ Rectangle() [2/2]

nkMaths::Rectangle::Rectangle | ( | float | x,
|  | float | y,
|  | float | width,
|  | float | height
| ) |  |
| noexcept

Constructor.

Parameters

  x | The x component of the origin.
  y | The y component of the origin.
  width | The rectangle width.
  height | The rectangle height.

## Member Function Documentation

## ◆ pointInside()

bool nkMaths::Rectangle::pointInside | ( | Point | point | ) | const

Checks if a point is inside the rectangle.

Parameters

  point | The point to check against the rectangle.

Returns
  If the point is inside (true) or not (false).

## ◆ operator+()

Rectangle nkMaths::Rectangle::operator+ | ( | const Rectangle & | other | ) | const

Overrides adding rectangles. Conceptually, sum components from the other rectangle with the calling one (origin + other.origin, dimensions + other.dimensions).

Parameters

  other | The rectangle to add.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsMaths/Geometry/Rectangle.h